package what.basic.basiccomponent;
import java.awt.*;
import javax.swing.*;
public class Jboxlayout {
	public static void main(String[] args) {
	boxlayout boxlay=new boxlayout();	
	}

}
class boxlayout{
	public boxlayout(){
		JFrame jf=new JFrame("boxlayout");
		jf.setSize(300,200);
		jf.setVisible(true);
		Container cn=jf.getContentPane();
		JLabel jlbl1=new JLabel("name:" );
		JTextField txt1=new JTextField(10);
		txt1.setMaximumSize(txt1.getPreferredSize());
		Box hbox1=Box.createHorizontalBox();
		hbox1.add(jlbl1);
		hbox1.add(Box.createHorizontalStrut(20));
		hbox1.add(txt1);
		JLabel jlbl2=new JLabel("pass:" );
		JTextField txt2=new JTextField(10);
		Box hbox2=Box.createHorizontalBox();
		hbox2.add(jlbl2);
		hbox2.add(Box.createHorizontalStrut(20));
		hbox2.add(txt2);
		Box vbox=Box.createVerticalBox();
		vbox.add(hbox1);
		vbox.add(hbox2);
		vbox.add(Box.createVerticalGlue());
		cn.add(vbox,BorderLayout.CENTER);
		
	}
}